<?php
    namespace app\index\model;
    use think\Model;
    use think\request;
    use think\Db;

    
    class Sign extends Model
    {

        public function sign_list(){
            $map =[];
            $request = Request::instance();
            $data = $this->where($map)->order('Sign_id asc')->select();
            return $data;
        }

        public function change($data){

            $id = $data['id'];
            $coursename = $data['coursename'];
            $time = $data['time'];
            $hint = $data['hint'];
            $status = $data['status'];

            
            
            $result = Db::table('sign')->where('Sign_id', $id)->Update([
                    'Sign_id'=>$id,
                    'Sign_course'=>$coursename,
                    'Sign_endtime'=>$time,
                    'Sign_hint'=>$hint,
                    'Sign_status'=> '已签'
                ]);
            //返回控制器
            if ($result) {
                return 1; //更新成功返回1
            } else {
                return 2; //更新失败返回2
            }
        }

    }
?>